﻿/******************************************************   
创建者: ljj
创建时间: 2018-03-13
修改:
修改时间: 
功能: 新品下单计算
 ******************************************************/

using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using com.nm.library.Excels;

namespace InventoryToPredictAPI.Export
{
    [Export(typeof(ExcelImport))]
    public class GoodsNewGoodsOrders : ExcelImport
    {
        public override ExcelImportType Type => ExcelImportType.GOODSNEWGOODSORDERS;
        public override Dictionary<string, ImportVerify> DictFields => _dictFields;

        private static readonly Dictionary<string, ImportVerify> _dictFields = new List<ImportVerify> {
            new ImportVerify{ ColumnName="大类",FieldName="KindName",DataType=typeof(string),VerifyFunc =(e,extra)=> ExcelImportHelper.GetCellMsg(e.CellValue,e.ColName,200,true,true)},
            new ImportVerify{ ColumnName="性别",FieldName="SexName",DataType=typeof(string),VerifyFunc =(e,extra)=> ExcelImportHelper.GetCellMsg(e.CellValue,e.ColName,200,true,true)},
            new ImportVerify{ ColumnName="子项",FieldName="ItemOrSub",DataType=typeof(string),VerifyFunc =(e,extra)=> ExcelImportHelper.GetCellMsg(e.CellValue,e.ColName,200,true,true)},
            new ImportVerify{ ColumnName="生产周期",FieldName="ProductDays",DataType=typeof(long?),VerifyFunc =(e,extra)=> ExcelImportHelper.GetCellMsg(e.CellValue,e.ColName,200,true,true)},
            new ImportVerify{ ColumnName="标准SKC数",FieldName="StandardSKC",DataType=typeof(long?),VerifyFunc =(e,extra)=> ExcelImportHelper.GetCellMsg(e.CellValue,e.ColName,200,true,true)},
            new ImportVerify{ ColumnName="标准陈列量",FieldName="DispalyQty",DataType=typeof(long?),VerifyFunc =(e,extra)=> ExcelImportHelper.GetCellMsg(e.CellValue,e.ColName,200,true,true)},
            new ImportVerify{ ColumnName="销售需求量",FieldName="MonthSaleQty",DataType=typeof(double?),VerifyFunc =(e,extra)=> ExcelImportHelper.GetCellMsg(e.CellValue,e.ColName,200,true,true)},
            new ImportVerify{ ColumnName="期末陈列需求",FieldName="DaySaleQty",DataType=typeof(double?),VerifyFunc =(e,extra)=> ExcelImportHelper.GetCellMsg(e.CellValue,e.ColName,200,true,true)},
            new ImportVerify{ ColumnName="建议下单量",FieldName="TotalQty",DataType=typeof(double?),VerifyFunc =(e,extra)=> ExcelImportHelper.GetCellMsg(e.CellValue,e.ColName,200,true,true)},
            new ImportVerify{ ColumnName="下单日期",FieldName="OrderDate",DataType=typeof(string),VerifyFunc =(e,extra)=> ExcelImportHelper.GetCellMsg(e.CellValue,e.ColName,200,true,true)},
            new ImportVerify{ ColumnName="预计回货时间",FieldName="ArriverDate",DataType=typeof(string),VerifyFunc =(e,extra)=> ExcelImportHelper.GetCellMsg(e.CellValue,e.ColName,200,true,true)},
        }.ToDictionary(e => e.ColumnName, e => e);

        public override object SaveImportData(DataTable dt, Dictionary<string, object> extraInfo, int userId)
        {
            throw new NotImplementedException();
        }

        public override DataTable GetExportData(string Keys)
        {
            var handler = new GoodsNewGoodsOrdersHandler();
            return handler.ExportGoodsNewGoodsOrders(Keys);
        }
    }
}
